CC=g++
CFLAGS=-Wall -O3
BOOST_INCLUDE=/home/liangjie/libraries/boost_1_47_0
TCLAP_INCLUDE=/export/crawlspace/liangjie/lib/tclap/include/
GSL_INCLUDE=/export/crawlspace/liangjie/lib/gsl/include/
GSL_LIB=/export/crawlspace/liangjie/lib/gsl/lib/
GSL_FLAGS=-lgsl -lgslcblas -ltbb
OBJS=puzatopic.o utils.o io.o def.o generator.o estimator.o topicmodel.o log.o cmd.o
puzatopic.exe:$(OBJS)
	rm -rf *~
	$(CC) -o puzatopic.exe $(OBJS) -L $(GSL_LIB) $(GSL_FLAGS)
puzatopic.o:puzatopic.cpp io.hpp cmd.hpp def.hpp metamodel.hpp topicmodel.hpp estimator.hpp generator.hpp utils.hpp log.hpp
	$(CC) $(CFLAGS) -c -I $(TCLAP_INCLUDE) -I $(GSL_INCLUDE) -I $(BOOST_INCLUDE) puzatopic.cpp
topicmodel.o:utils.hpp def.hpp log.hpp io.hpp topicmodel.hpp topicmodel_getmodel.hpp topicmodel.cpp topicmodel_generic_model.hpp topicmodel_lda_abstract.hpp topicmodel_geo_abstract.hpp topicmodel_lda_gibbs.cpp topicmodel_lda_vb.cpp topicmodel_lda_vbonline.cpp topicmodel_tot.cpp topicmodel_geo_simple_1_batch.cpp topicmodel_geo_simple_1_online.cpp topicmodel_at_batch.cpp topicmodel_at_online.cpp topicmodel_geo_cluster_batch.cpp topicmodel_geo_mf_loc.cpp topicmodel_geo_mf_online.cpp topicmodel_geo_mf_topic.cpp topicmodel_geo_mf_topic_geo_back.cpp topicmodel_geo_mf_topic_back.cpp topicmodel_geo_mf_loc_back.cpp
	$(CC) $(CFLAGS) -c -I $(TCLAP_INCLUDE) -I $(GSL_INCLUDE) -I $(BOOST_INCLUDE) topicmodel.cpp	
generator.o:def.hpp io.hpp generator.hpp generator_multinomial.hpp generator_dirichlet.hpp generator_polya.hpp generator.cpp 
	$(CC) $(CFLAGS) -c -I $(TCLAP_INCLUDE) -I $(GSL_INCLUDE) -I $(BOOST_INCLUDE) generator.cpp
estimator.o:def.hpp estimator.hpp utils.hpp io.hpp estimator.hpp estimator_polya.cpp est_polya_moment.cpp est_polya_sgd.cpp est_polya_newton.cpp est_polya_fixedpoint.cpp estimator.cpp
	$(CC) $(CFLAGS) -c -I $(TCLAP_INCLUDE) -I $(GSL_INCLUDE) -I $(BOOST_INCLUDE) estimator.cpp
cmd.o:cmd.cpp cmd.hpp def.hpp
	$(CC) $(CFLAGS) -c -I $(TCLAP_INCLUDE) -I $(GSL_INCLUDE) -I $(BOOST_INCLUDE) cmd.cpp
log.o:def.hpp io.hpp log.hpp log.cpp
	$(CC) $(CFLAGS) -c -I $(TCLAP_INCLUDE) -I $(GSL_INCLUDE) -I $(BOOST_INCLUDE) log.cpp
utils.o:def.hpp utils.hpp utils.cpp
	$(CC) $(CFLAGS) -c -I $(TCLAP_INCLUDE) -I $(GSL_INCLUDE) -I $(BOOST_INCLUDE) utils.cpp
io.o:def.hpp io.hpp io.cpp
	$(CC) $(CFLAGS) -c -I $(TCLAP_INCLUDE) -I $(GSL_INCLUDE) -I $(BOOST_INCLUDE) io.cpp
def.o:def.hpp def.cpp
	$(CC) $(CFLAGS) -c -I $(TCLAP_INCLUDE) -I $(GSL_INCLUDE) -I $(BOOST_INCLUDE) def.cpp
clean:
	rm -rf *~ *.o puza.exe
tar:
	tar zcfv puzatopic.tar.gz *.cpp *.hpp Makefile
